home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
emerald
/
emrldsys.lha
/
Language
/
Compiler
/
set.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-16
|
1KB
|
63 lines
/*
* @(#)set.h 1.2 6/29/87
*/
#ifndef set_h
#define set_h
/*
* Sets contain sets of integers. There are
* create, insert, lookup, and destroy operations.
*/
typedef struct STE {
int key; /* the key for this entry */
} STE, *STEPtr;
typedef struct SetRecord {
STEPtr table;
int maxIndex, maxCount, count;
} SetRecord, *Set;
#define NIL ((unsigned)0x80000000)
Set Set_Create();
Set Set_CreateSized(/* count */);
/* int count */
void Set_Insert(/* set, key, value */);
/* Set set; int key, value; */
#define SET_INSERT(s,e) {if (s == NULL) s = Set_Create(); Set_Insert(s, (int)e); }
int Set_Lookup(/* set, key */);
/* Set set; int key; */
void Set_Delete(/* set, key */);
/* Set set; int key; */
void Set_Destroy(/* set */);
/* Set set; */
void Set_Print(/* set */);
/* Set set; */
void Set_Merge(/* from, to */);
/* Set from, to; */
#define Set_Size(s) ((s) == NULL ? 0 : (s)->count)
#define Set_GetFirst(s, f) { \
int z__z = 0; \
Set_FindNext((s), &z__z, (int *)&f); \
}
#define Set_For(key, m) \
{ \
int z__z = 0; \
while (Set_FindNext((m), &z__z, (int *)&key)) {
#define Set_Next \
} \
}
#define Set_Count(m) ((m)->count)
#endif